/**
 */
package com.my.mytask.mytask.impl;

import com.my.mytask.mytask.ContCon;
import com.my.mytask.mytask.DocumentRoot;
import com.my.mytask.mytask.MytaskPackage;
import com.my.mytask.mytask.RoleCon;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Document Root</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.my.mytask.mytask.impl.DocumentRootImpl#getContCon <em>Cont Con</em>}</li>
 *   <li>{@link com.my.mytask.mytask.impl.DocumentRootImpl#getRoleCon <em>Role Con</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DocumentRootImpl extends EObjectImpl implements DocumentRoot {
	/**
	 * The cached value of the '{@link #getContCon() <em>Cont Con</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getContCon()
	 * @generated
	 * @ordered
	 */
	protected ContCon contCon;

	/**
	 * The cached value of the '{@link #getRoleCon() <em>Role Con</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRoleCon()
	 * @generated
	 * @ordered
	 */
	protected RoleCon roleCon;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DocumentRootImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MytaskPackage.Literals.DOCUMENT_ROOT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ContCon getContCon() {
		return contCon;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetContCon(ContCon newContCon, NotificationChain msgs) {
		ContCon oldContCon = contCon;
		contCon = newContCon;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MytaskPackage.DOCUMENT_ROOT__CONT_CON, oldContCon, newContCon);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setContCon(ContCon newContCon) {
		if (newContCon != contCon) {
			NotificationChain msgs = null;
			if (contCon != null)
				msgs = ((InternalEObject)contCon).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MytaskPackage.DOCUMENT_ROOT__CONT_CON, null, msgs);
			if (newContCon != null)
				msgs = ((InternalEObject)newContCon).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MytaskPackage.DOCUMENT_ROOT__CONT_CON, null, msgs);
			msgs = basicSetContCon(newContCon, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MytaskPackage.DOCUMENT_ROOT__CONT_CON, newContCon, newContCon));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RoleCon getRoleCon() {
		return roleCon;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetRoleCon(RoleCon newRoleCon, NotificationChain msgs) {
		RoleCon oldRoleCon = roleCon;
		roleCon = newRoleCon;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MytaskPackage.DOCUMENT_ROOT__ROLE_CON, oldRoleCon, newRoleCon);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRoleCon(RoleCon newRoleCon) {
		if (newRoleCon != roleCon) {
			NotificationChain msgs = null;
			if (roleCon != null)
				msgs = ((InternalEObject)roleCon).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MytaskPackage.DOCUMENT_ROOT__ROLE_CON, null, msgs);
			if (newRoleCon != null)
				msgs = ((InternalEObject)newRoleCon).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MytaskPackage.DOCUMENT_ROOT__ROLE_CON, null, msgs);
			msgs = basicSetRoleCon(newRoleCon, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MytaskPackage.DOCUMENT_ROOT__ROLE_CON, newRoleCon, newRoleCon));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case MytaskPackage.DOCUMENT_ROOT__CONT_CON:
				return basicSetContCon(null, msgs);
			case MytaskPackage.DOCUMENT_ROOT__ROLE_CON:
				return basicSetRoleCon(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MytaskPackage.DOCUMENT_ROOT__CONT_CON:
				return getContCon();
			case MytaskPackage.DOCUMENT_ROOT__ROLE_CON:
				return getRoleCon();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MytaskPackage.DOCUMENT_ROOT__CONT_CON:
				setContCon((ContCon)newValue);
				return;
			case MytaskPackage.DOCUMENT_ROOT__ROLE_CON:
				setRoleCon((RoleCon)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MytaskPackage.DOCUMENT_ROOT__CONT_CON:
				setContCon((ContCon)null);
				return;
			case MytaskPackage.DOCUMENT_ROOT__ROLE_CON:
				setRoleCon((RoleCon)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MytaskPackage.DOCUMENT_ROOT__CONT_CON:
				return contCon != null;
			case MytaskPackage.DOCUMENT_ROOT__ROLE_CON:
				return roleCon != null;
		}
		return super.eIsSet(featureID);
	}

} //DocumentRootImpl
